package com.qiyang.uaa.dao.entity;

import javax.persistence.*;
import java.util.*;

/**
 * Created on 2018/5/31.
 *
 * @author sehuaqi.
 * 描述：
 */
@Entity
@Table(name = "sys_user", schema = "spc_study_db", catalog = "")
public class SysUser {
    private int id;
    private String username;
    private String pwd;
    private String salt;
    private String nickname;
    private Integer status;
    private String mobile;
    private String email;

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "pwd")
    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    @Basic
    @Column(name = "salt")
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    @Basic
    @Column(name = "nickname")
    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Basic
    @Column(name = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SysUser that = (SysUser) o;
        return id == that.id &&
                Objects.equals(username, that.username) &&
                Objects.equals(pwd, that.pwd) &&
                Objects.equals(salt, that.salt) &&
                Objects.equals(nickname, that.nickname) &&
                Objects.equals(status, that.status) &&
                Objects.equals(mobile, that.mobile) &&
                Objects.equals(email, that.email);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, username, pwd, salt, nickname, status, mobile, email);
    }

//    @JoinTable(name = "sys_user_role",joinColumns = {
//            @JoinColumn(name = "user_id",referencedColumnName = "id")
//    },inverseJoinColumns ={
//            @JoinColumn(name = "role_id",referencedColumnName = "id")
//    })

//    @ManyToMany(cascade = CascadeType.ALL, mappedBy = "sysUsers")
//    private Set<SysRole> sysRoles;
//
//    public Set<SysRole> getSysRoles() {
//        return sysRoles;
//    }
//
//    public void setSysRoles(Set<SysRole> sysRoles) {
//        this.sysRoles = sysRoles;
//    }
}
